package JAVA300.第十一章多线程;

/**
 * lamda表达式测试理解--添加返回值 以及参数个数
 */
public class thread_09_lamdaTest3 {

    //2。静态内部类
    static class huawei implements Computer {
        @Override
        public void compute() {
            System.out.println("这是华为笔记本");
        }
    }
    public static void main(String[] args) {
        ComputerNew2 com1 = new lenovoNew2();
        com1.compute(1,1);

        //lamda
        ComputerNew2 com2 = ( a2, b2)-> {

            System.out.println("这是lamda1笔记本"+ a2+"--"+b2);
            return a2+b2;
        };
        com2.compute(2,2);

        //只有return一行，省掉return
        ComputerNew2 com3 = ( a3, b3) ->a3+b3 ;
        System.out.println(com3.compute(3,3));

        //指定返回对象
        ComputerNew2 com4 = ( a3, b3) ->100 ;


    }
}

interface ComputerNew2{
    int compute(int a,int b);
}

//1.经典接口实现
class lenovoNew2 implements ComputerNew2{
    @Override
    public int compute(int a1,int b1) {

        System.out.println("这是联想笔记本"+ a1+"--"+b1);
        return a1+b1;
    }

}
